package com.entity;

// Generated 09.02.2014 20:16:29 by Hibernate Tools 3.4.0.CR1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * IssueEntity generated by hbm2java
 */
@Entity
@Table(name = "issue", catalog = "jiraexcel", uniqueConstraints = {
		@UniqueConstraint(columnNames = "id"),
		@UniqueConstraint(columnNames = "key_issue") })
public class IssueEntity implements java.io.Serializable {

	private Integer idIssue;
	private FieldsEntity fieldsEntity;
	private String id;
	private String self;
	private String keyIssue;
	private Set<WatchersEntity> watchersEntities = new HashSet<WatchersEntity>(
			0);
	private Set<FieldsEntity> fieldsEntities = new HashSet<FieldsEntity>(0);
	private Set<SubtasksEntity> subtasksEntities = new HashSet<SubtasksEntity>(
			0);

	public IssueEntity() {
	}

	public IssueEntity(FieldsEntity fieldsEntity) {
		this.fieldsEntity = fieldsEntity;
	}

	public IssueEntity(FieldsEntity fieldsEntity, String id, String self,
			String keyIssue, Set<WatchersEntity> watchersEntities,
			Set<FieldsEntity> fieldsEntities,
			Set<SubtasksEntity> subtasksEntities) {
		this.fieldsEntity = fieldsEntity;
		this.id = id;
		this.self = self;
		this.keyIssue = keyIssue;
		this.watchersEntities = watchersEntities;
		this.fieldsEntities = fieldsEntities;
		this.subtasksEntities = subtasksEntities;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_issue", unique = true, nullable = false)
	public Integer getIdIssue() {
		return this.idIssue;
	}

	public void setIdIssue(Integer idIssue) {
		this.idIssue = idIssue;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_fields", nullable = false)
	public FieldsEntity getFieldsEntity() {
		return this.fieldsEntity;
	}

	public void setFieldsEntity(FieldsEntity fieldsEntity) {
		this.fieldsEntity = fieldsEntity;
	}

	@Column(name = "id", unique = true, length = 100)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "self", length = 1000)
	public String getSelf() {
		return this.self;
	}

	public void setSelf(String self) {
		this.self = self;
	}

	@Column(name = "key_issue", unique = true, length = 100)
	public String getKeyIssue() {
		return this.keyIssue;
	}

	public void setKeyIssue(String keyIssue) {
		this.keyIssue = keyIssue;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "issueEntity")
	public Set<WatchersEntity> getWatchersEntities() {
		return this.watchersEntities;
	}

	public void setWatchersEntities(Set<WatchersEntity> watchersEntities) {
		this.watchersEntities = watchersEntities;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "issueEntity")
	public Set<FieldsEntity> getFieldsEntities() {
		return this.fieldsEntities;
	}

	public void setFieldsEntities(Set<FieldsEntity> fieldsEntities) {
		this.fieldsEntities = fieldsEntities;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "subtasks_has_issue", catalog = "jiraexcel", joinColumns = { @JoinColumn(name = "issue_id_issue", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "subtasks_id_subtasks", nullable = false, updatable = false) })
	public Set<SubtasksEntity> getSubtasksEntities() {
		return this.subtasksEntities;
	}

	public void setSubtasksEntities(Set<SubtasksEntity> subtasksEntities) {
		this.subtasksEntities = subtasksEntities;
	}

}
